Understanding Blockchain Consensus Mechanisms

2023-07-01

The role of a consensus mechanism is to ensure that the data across most nodes remains consistent. Consensus mechanisms can be broadly categorized into two types: PoW (Proof of Work) style and PBFT (Practical Byzantine Fault Tolerance) style. Almost all consensus mechanisms fall under these two styles.

Let’s start from scratch and think about how to maintain consistency among a group of humans. One method is to elect a leader whose opinion everyone follows. Another method is to make decisions collectively through discussion to reach a unified opinion.

For the first method, the challenge lies in how to elect the leader, the criteria for selection, and what kind of person can become the leader. For the second method, the challenge is who can participate in the discussion and how decisions are made.

First, let’s look at the first method, which mainly involves three steps:

  1. Elect a leader through some means.
  2. Everyone listens to the leader within a time unit.
  3. Everyone reaches a consensus within a time unit.

The PoW process is as follows:

  1. The miner who solves the hash puzzle becomes the block-producing node.
  2. All nodes receive and validate the miner’s block.
  3. All nodes’ block data reach a consensus.

In this PoW style consensus process, the biggest variable is the first step, which is how to elect the block-producing node. Therefore, there are many variants of PoW consensus.

These are examples of PoW style consensus mechanisms. Despite their efforts to change the way block-producing nodes are selected, all these blockchains follow the three-step process.

Now, let’s look at the second method, which also involves three steps:

  1. Select decision-makers through some means.
  2. Decision-makers communicate and reach a consensus.
  3. Everyone else follows the decision to reach a consensus.

The PBFT process is as follows:

  1. Select consensus nodes from all nodes, then rotate the role of proposer among them.
  2. Consensus nodes undergo two rounds of voting on the proposal content.
  3. Consensus nodes reach an agreement, and other nodes follow suit to reach a consensus.

Compared to the first method, the single leader is replaced by multiple decision-makers. In this PBFT style consensus process, the biggest variable is also the first step, which is how to select consensus nodes and determine the order of proposer nodes. Here are some variants:

In summary, both PoW and PBFT styles filter out content that can ultimately achieve consensus through some means, but they fundamentally differ in how content is selected. In PoW, other nodes unconditionally accept the source block as long as it meets certain criteria. In PBFT, other nodes receive the block content first, then decide whether to accept it through a voting process before reaching a consensus.

There are also some innovative types of consensus, such as hybrid consensus combining multiple consensus mechanisms. These may evaluate node reputation, score based on historical transaction quality, or use hardware devices like mobile phones and IoT for data validation. Additionally, optimizations in PBFT, such as parallelism at certain stages, fault tolerance, and network efficiency, still fall within the frameworks of PoW and PBFT.

Therefore, it can be boldly stated that consensus mechanisms are essentially the same, differing only in their specific design and implementation.